<?php
session_start();
error_reporting(E_ALL || E_STRICT);
include('paginator.class.php');
include("../connection/connection.php");
$loginid=$_SESSION['loginid'];
$query2="select * from tbl_dtls_compose where status='1' and receiver in('$loginid')";
$result2=mysql_query($query2);
$no_of_record1=mysql_num_rows($result2); 

$query="select * from tbl_dtls_compose where receiver in('$loginid')";
$result=mysql_query($query);
$no_of_record=mysql_num_rows($result); 
if($_SERVER['HTTP_HOST']=="www.zioninformatics.com"||$_SERVER['HTTP_HOST']=="zioninformatics.com")
{
	$conn = new mysqli('localhost', 'samir696_phed', '1q2w3e4r5t6y','samir696_phed') ;
}
else
{
	$conn = new mysqli('localhost', 'root', '','ramky123_phed') ;
}
$query="select * from tbl_dtls_compose where receiver in('$loginid')";
if(!empty($_GET['search'])){
	$searchQuery = $_GET['search'];
}

$pageId= intval($_GET['page']);
if (empty($pageId)) {
	$pageId = 1;
}else{
	$pageId = intval($pageId); 
}

$recPerPage = 50;
$paginator = new Paginator($pageId,$recPerPage,$query,$conn);

// fields to search in
// string or array of fields
$paginator->fields = 'name';
$paginator->searchQuery = $searchQuery;
$rows = $paginator->paginate();
?>
<table border="0" width="100%" id="table21" height="100%" cellspacing="1" style="padding-top:0px">
  <tr bgcolor="#FF9966" height="29">
	<td bgcolor="#FF9966" align="left" valign="top">&nbsp;</td>
	<td bgcolor="#FF9966" align="left" valign="top">&nbsp;</td>
	<td bgcolor="#FF9966" align="left" valign="top" colspan="5">&nbsp;</td>
    <td bgcolor="#FF9966" align="left" valign="top">&nbsp;</td>
	<td bgcolor="#FF9966" align="left" valign="top">&nbsp;</td>
  </tr>
  <tr>
	<td bgcolor="#E5E5E5" align="left" valign="top" width="1%">&nbsp;</td>
	<td bgcolor="#E5E5E5" align="left" valign="top" width="5%"><img border="0" src="images/my_pag2.jpg"></td>
	<td bgcolor="#E5E5E5" align="left" width="91%" colspan="5"><span lang="en-us">&nbsp;</span><span lang="en-us" style="font-size:       8.5pt"><font face="Verdana" color="#006699"><b>INBOX</b></font><font color="#000000" face="Verdana"> 
	   (</font></span><font color="#000000" face="Verdana"><span style="font-size: 8.5pt"><span lang="en-us"><b>(<?php echo         $no_of_record1;?>)</b></span><span lang="en-us">Unread M</span>ails<span lang="en-us">)</span></span></font></td>
       <td bgcolor="#E5E5E5" align="left" valign="top" width="1%">&nbsp;</td>
	<td bgcolor="#E5E5E5" align="left" valign="top" width="5%"></td>
  </tr>
  <tr>
	<td bgcolor="#E5E5E5" align="left" valign="top">&nbsp;</td>
	<td bgcolor="#E5E5E5" align="left" valign="top">&nbsp;</td>
	<td bgcolor="#E5E5E5" align="left" valign="top"><font color="#000000" face="Verdana">
	  <span style="font-size: 8.5pt">&nbsp;Welcome to the<span lang="en-us">Inbox</span></span></font></td>
	<td bgcolor="#E5E5E5" align="left" valign="top"><span lang="en-us">
	   <font face="Verdana" style="font-size: 8.5pt" color="#000000">
	   </font></span><font color="#000000" face="Verdana"><span style="font-size: 8.5pt">&nbsp;You have messages&nbsp;<b>(<?php echo $no_of_record;?>)</b></span></font></td>
	<td bgcolor="#E5E5E5" align="left" valign="top" width="7%"><p align="right"></td>
	<td bgcolor="#E5E5E5" align="left" valign="top" width="11%"><p align="right"></td>
	<td bgcolor="#E5E5E5" align="left" valign="top" width="8%">&nbsp;</td>
    <td bgcolor="#E5E5E5" align="left" valign="top">&nbsp;</td>
	<td bgcolor="#E5E5E5" align="left" valign="top">&nbsp;</td>
  </tr>
  <tr>
	 <td bgcolor="#E5E5E5" align="left" valign="top" colspan="7">
	   <span style="font-size: 3pt" lang="en-us">&nbsp;</span></td>
       <td bgcolor="#E5E5E5" align="left" valign="top" colspan="7"></td>
  </tr>
  <tr>
	<td bgcolor="#E5E5E5" align="left" valign="top">&nbsp;</td>
	<td bgcolor="#E5E5E5" align="left" valign="top">&nbsp;</td>
	<td bgcolor="#E5E5E5" align="left" valign="top" colspan="5" bordercolor="#F2F2F2"></td>
    <td bgcolor="#E5E5E5" align="left" valign="top">&nbsp;</td>
	<td bgcolor="#E5E5E5" align="left" valign="top">&nbsp;</td>
  </tr>
  <tr>
	<td bgcolor="#E5E5E5" align="left" valign="top">&nbsp;</td>
	<td bgcolor="#E5E5E5" align="left" valign="top">&nbsp;</td>
	<td align="left" valign="top" colspan="5">
	<form name="myform" action="del1.php" method="post" id="frm1">
	<table border="1" bordercolor="#003366" style="border-style:solid; border-collapse:collapse" width="100%" id="rcrd">
    <tr>
	<td width="26" height="22">&nbsp;</td>
	<td width="9" height="22">&nbsp;</td>
	<td width="9" height="22">&nbsp;</td>
	<td width="124" height="22">
	     <font color="#000000" face="Verdana">
		 <span style="font-size: 8.5pt; font-weight: 700">
		 FROM</span></font></td>
	<td height="22"> <font color="#000000" face="Verdana">
					 <span style="font-size: 8.5pt; font-weight: 700">
					  SUBJECT</span></font></td>
	<td width="84" height="22">
						<span style="font-weight: 700" lang="en-us">
						<font face="Verdana" style="font-size: 8.5pt" color="#000000">
						DATE</font></span></td>
   </tr>
         <?php
		foreach($rows as $row)
     		{
   		?>
    <tr>
		<td bgcolor="" width="26">&nbsp;</td>
		<td bgcolor="" width="9"><font style="font-size: 8.5pt" face="Verdana" color="#000000">
		<input type="checkbox" name="ids[]" value="<?php echo $row['id'];?>" /></font></td>
		<td bgcolor="" width="9">
		                                <?php 
										if($row['status']=='0')
										{?>
										<img border="0" src="images/open_mail.JPG">
										<?php }
										?>
										<?php 
										if($row['status']=='1')
										{?>
								        <img border="0" src="images/invest5.jpg">
										<?php } ?>										</td>
									    <td bgcolor="" width="124">
									      <font style="font-size: 8.5pt" face="Verdana" color="#000000">
	
									    <?php echo $row['sender']; ?></font></td>
									    <td bgcolor="">
										
										<span lang="en-us">&nbsp;</span>
										<font style="font-size: 8.5pt" face="Verdana" color="#000000">
								<a style="text-decoration:none; color:#000000" href="inbox_mail.php?id=<?php echo $row['id'];?>"><?php  echo $row['sub'];?> </a>
							</font>
							</td>
									    <td bgcolor="" width="84">
									      <font style="font-size: 8.5pt" face="Verdana" color="#000000">
							            	<?php 
										echo $row['post_time'];
										
										?></font></td>
									  </tr>
									  <?php
									  }
									  ?>
									   <tr>
								        <td width="26" height="22">&nbsp;</td>
									    <td width="9" height="22">&nbsp;</td>
									    <td width="9" height="22">&nbsp;</td>
									    <td height="22" colspan="2"></td>
									    <td width="84" height="22">&nbsp;</td>
									  </tr>
									  <tr>
								        <td bgcolor="#F2F2F2" width="26">&nbsp;</td>

<td bgcolor="#F2F2F2" colspan="4">&nbsp;


<input name="checkall" type="button" onclick='checkedAll(frm1);' value="Select All" style="border:1px solid #000000; font-size: 8pt; font-family: Verdana; "/>&nbsp;
<input type="submit" value="Delete Selected" name="B1" style="border:1px solid #000000; font-size: 8pt; font-family: Verdana; "/>
</td>
<td bgcolor="#F2F2F2" width="84">&nbsp;</td>
</tr></table></form></td>
<td bgcolor="#E5E5E5" align="left" valign="top">&nbsp;</td>
	<td bgcolor="#E5E5E5" align="left" valign="top">&nbsp;</td>
</tr>
<tr>
				            <td bgcolor="#E5E5E5" align="left" valign="top">&nbsp;</td>
								  <td bgcolor="#E5E5E5" align="left" valign="top">&nbsp;</td>
								  <td bgcolor="#E5E5E5" align="left" valign="top" colspan="5">
								    <font color="#000000" face="Verdana">
							        <span style="font-size: 8.5pt">
							        <img border="0" src="images/invest5.jpg"> = 
						          Unread</span></font></td>
                                  <td bgcolor="#E5E5E5" align="left" valign="top">&nbsp;</td>
								  <td bgcolor="#E5E5E5" align="left" valign="top">&nbsp;</td>
	  </tr>
         <tr>
            <td bgcolor="#E5E5E5" align="left" valign="top">&nbsp;</td>
								  <td bgcolor="#E5E5E5" align="left" valign="top">&nbsp;</td>
								  <td bgcolor="#E5E5E5" align="left" valign="top" colspan="5">
								    <font color="#000000" face="Verdana">
							        <span style="font-size: 8.5pt">
							        <img border="0" src="images/open_mail.JPG" width="18" height="16"> 
						          = Read</span></font></td>
                                  <td bgcolor="#E5E5E5" align="left" valign="top">&nbsp;</td>
								  <td bgcolor="#E5E5E5" align="left" valign="top">&nbsp;</td>
 </tr>
</table>	
<?php
$links = $paginator->getLinks ();
echo "<div class='paginator'> " . $links ;

echo "<p>Page " . $paginator->pageId . " of " . $paginator->totalPages . "</p>";
echo "</div>";
?>
</div>
